package org.candan.spider.task.xml;

import org.candan.spider.bean.DataSift;
import org.candan.spider.bean.TagSift;
import org.candan.spider.util.DateUtil;
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;


public class TagSiftParse {
	/**
	 * @category HttpFilter转换成XML
	 * @param plan
	 * @return
	 */
	public Element tagFilterToXML(TagSift result){
		Element el = new DefaultElement(XMLProperty.tagFilter);
		el.addAttribute(XMLProperty.filterType, result.getFilterType());
		el.addAttribute(XMLProperty.tag, result.getTag());
		el.addAttribute(XMLProperty.keywords, result.getKeywords());
		return el;
	}
	
	/**
	 * @category xml转换成HttpFilter实体类
	 * @param el
	 * @return
	 */
	public TagSift  xmlToTagFilger(Element el){
		TagSift result = new TagSift();
		result.setFilterType(el.attributeValue(XMLProperty.filterType));
		result.setTag( el.attributeValue(XMLProperty.tag));
		result.setKeywords( el.attributeValue(XMLProperty.keywords));
		return result;
	}
}
